<template>
  <div class="Export">
    <Dialog
      v-model:visible="visible"
      title="导出 "
      width="400px"
      @handleClickConfirm="handleConfirm"
    >
      <div style="width: 100%;text-align: center;">
        <el-radio-group v-model="formData.val1" >
          <el-radio label="导出全部"></el-radio>
          <el-radio label="导出所选"></el-radio>
        </el-radio-group>
      </div>
    </Dialog>
  </div>
</template>
<script setup>
import { exportExcel } from "@/plugins/exportExcel.js";
const { proxy } = getCurrentInstance();
const props = defineProps({
  coloumData:{
    type:Array
  }
})
const visible = ref(false);
let formData = ref({});
provide("confirmText", "导出")
const init = (e) => {
  formData.value = {
    val1:"导出全部"
  };
  visible.value = true;
};
const exportName = inject("exportName", "导出文件");
// 表单提交
const emits = defineEmits(["success"]);
const columnsTitle = ref([])
props.coloumData.map(item=>{
  if (item.type == "text") {
    columnsTitle.value.push(item.label);
  }
});
const handleConfirm = () => {
  exportExcel({
    fileName:exportName,
    columnsTitle:columnsTitle.value,
  })
  visible.value = false;
};

defineExpose({
  init,
  handleConfirm
});
</script>
<style scoped>
/* @import url(); 引入css类 */
</style>
